const state = {
  crypto: {
    cryptoEnable: false,
    cryptoSaltName: '',
    cryptoSecretKeyName: '',
    cryptoStrategy: '',
  },
  sign: {
    signEnable: '',
    signName: '',
    signSaltName: '',
    signStrategy: ''
  }
}

const mutations = {
  SET_CRYPTO: (state, val) => {
    if(val) {

      state.crypto = Object.assign(state.crypto, val)
      window.localStorage.setItem('crypto',JSON.stringify(val))
    }
  },
  SET_SIGN: (state, val) => {
    if(val) {

      state.sign = Object.assign(state.sign, val)
      window.localStorage.setItem('sign',JSON.stringify(val))
    }
  },
}

const actions = {

  SetCrypto({ commit }, view) {
    commit('SET_CRYPTO', view)
  },
  SetSign({ commit }, view) {
    commit('SET_SIGN', view)
  },
}

export default {
  state,
  mutations,
  actions
}
